package com.music.music.service.impl;

import java.util.List;

import com.music.music.vo.MusicVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.music.music.mapper.MusicMapper;
import com.music.music.domain.Music;
import com.music.music.service.MusicService;

import javax.annotation.Resource;

/**
 * 音乐列表Service业务层处理
 *
 * @author ruoyi
 * @date 2024-10-22
 */
@Service
public class MusicServiceImpl implements MusicService {
    @Resource
    private MusicMapper musicMapper;

    /**
     * 查询音乐列表
     *
     * @param musicId 音乐列表主键
     * @return 音乐列表
     */
    @Override
    public MusicVo selectMusicByMusicId(Long musicId) {
        return musicMapper.selectMusicVoByMusicId(musicId);
    }

    /**
     * 查询音乐列表列表
     *
     * @param music 音乐列表
     * @return 音乐列表
     */
    @Override
    public List<MusicVo> selectMusicList(Music music) {
        return musicMapper.selectMusicVoList(music);
    }

    /**
     * 新增音乐列表
     *
     * @param music 音乐列表
     * @return 结果
     */
    @Override
    public int insertMusic(Music music) {
        music.setMusicCollect(0);
        music.setMusicSales(0);
        return musicMapper.insertMusic(music);
    }

    /**
     * 修改音乐列表
     *
     * @param music 音乐列表
     * @return 结果
     */
    @Override
    public int updateMusic(Music music) {
        return musicMapper.updateMusic(music);
    }

    /**
     * 批量删除音乐列表
     *
     * @param musicIds 需要删除的音乐列表主键
     * @return 结果
     */
    @Override
    public int deleteMusicByMusicIds(Long[] musicIds) {
        return musicMapper.deleteMusicByMusicIds(musicIds);
    }

    /**
     * 删除音乐列表信息
     *
     * @param musicId 音乐列表主键
     * @return 结果
     */
    @Override
    public int deleteMusicByMusicId(Long musicId) {
        return musicMapper.deleteMusicByMusicId(musicId);
    }

    @Override
    public String findMusicNameById(Long musicId) {
        return musicMapper.selectMusicNameById(musicId);
    }

    @Override
    public List<MusicVo> selectMusicList2(Music music) {
        return musicMapper.selectMusicVoList2(music);
    }

    @Override
    public int updateMusicCollectCount(Music music) {
        return musicMapper.updateMusicCollectCount(music);
    }

    @Override
    public int updateMusicsCollectCount(Long[] collectMusicIds, Integer delMusicCollectCount) {
        return musicMapper.updateMusicsCollectCount(collectMusicIds, delMusicCollectCount);
    }
}
